from rest_framework.filters import BaseFilterBackend


# class MyFilter(BaseFilterBackend):
#     def filter_queryset(self, request, queryset, view):
#         # 在这里面实现过滤，一定要返回qs对象，过滤后的数据
#         doctor = request.query_params.get('doctor', None)
#         department = request.query_params.get('department', None)
#         if doctor:
#             queryset = queryset.filter(doctor__name__icontains=doctor)
#
#         if department:
#             queryset = queryset.filter(department__id=department)
#         return queryset